<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>加油优惠价格计算</title>
</head>
<body>
    <script>
        //用户输入汽油编号
        var gasType = prompt('请输入汽油编号（92或97)：');
        //用户输入加油量
        var gasAmount = prompt('请输入你要加多少升：');
        //根据用户输入的加油号和加油量计算价格
        var singlePrice = 0;
        var totalPrice  = 0;
        if(gasType === '92'){
            if(gasAmount  >=20){
            totalPrice = gasAmount * 5.9;
            singlePrice = 5.9;
        } else{
            totalPrice =gasAmount * 6;
            singlePrice = 6;
        }
    } else if(gasType ==='97'){
        if(gasAmount  >=40){
            totalPrice = gasAmount * 6.5;
            singlePrice = 6.5;
        } else{
            totalPrice =gasAmount * 7;
            singlePrice = 7;
        }
    }
    // 输出价格
    document.write('汽油'+ singlePrice + '元一升；');
    document.write('共计'+ totalPrice + '元');

    </script>
</body>
</html>